<?php

class  Somi_Models_Jobi extends Zend_Db_Table_Abstract 
{
	protected $_name='jobi';
	protected $_primary = 'jobi_id';
	#protected $_rowClass = 'user';
	protected $_sequence  = true;
	
    
	public function getJobi($id){		
    	$jobi = $this->fetchRow('jobi_id="'.$id.'"');
    	return $jobi;
    }
	
    public function getAll(){  	
    	$db= Zend_Registry::get('db');
    	$select=$db->select();
    	$select->from('jobi');
    	$erg=$db->fetchAll($select);
    	return $erg;
    }
    
    public function update($daten,$id){
    	$db= Zend_Registry::get('db');
    	$db->beginTransaction();
    	try{
    	$db->update('jobi',$daten,'jobi_id="'.$id.'"');
    	$db->commit();
    	}catch(Exception $e){
    		$db->rollBack();
    	}    	
    }
    
	public function insert($daten){
    	$db= Zend_Registry::get('db');
    	$db->beginTransaction();
    	try{
    	$db->insert('jobi',$daten);
    	$db->commit();
    	}catch(Exception $e){
    		$db->rollBack();
    	}   	
    }
    
	public function delete($id){
    	$db= Zend_Registry::get('db');
    	$db->beginTransaction();
    	try{
    	$db->delete('jobi','jobi_id="'.$id.'"');
    	$db->commit();
    	}catch(Exception $e){
    		$db->rollBack();
    	}   	
    }
    
    
	public function getStatus(){
    	$db= Zend_Registry::get('db');
		$temp = $db->describeTable('jobi'); 
		$temp_enum = $temp['status']['DATA_TYPE'];
		$temp = explode("','",preg_replace("/(enum|set)\('(.+?)'\)/","\\2",$temp_enum));		
    	return $temp;
    	
    }
    
	
}

?>